var locale = chrome.i18n.getMessage; // Short-hand

var settings = new Array();
settings["interval"] = {value:120,type:"int"};
settings["autologin"] = {value:false,type:"bool"};

// Localization
for(var key in settings){
    settings[key].comment = locale("opt_c_" + key);
    settings[key].text = locale("opt_t_" + key);
}

function loadSettings(){
    for(var key in settings){
        if(!localStorage.getItem(key)){
            localStorage.setItem(key,settings[key].value);
        }
        else{
            settings[key].value = localStorage.getItem(key);
            console.log(key + " loaded");
        }
    }
}
function saveSettings(){
    for(var key in settings){
        localStorage.setItem(key,settings[key].value);
        console.log(key + " saved");
    }
}
